package jf.collections;

/**
 * @author ivanalx
 * @date 06.05.2009 15:49:15
 */
public class Tuple3<A, B, C> {
	public final A _1;
	public final B _2;
	public final C _3;

	public Tuple3(A _1, B _2, C _3) {
		this._1 = _1;
		this._2 = _2;
		this._3 = _3;
	}

	public A _1() {
		return _1;
	}

	public B _2() {
		return _2;
	}

	public C _3() {
		return _3;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Tuple3)) {
			return false;
		}

		Tuple3 tuple3 = (Tuple3) o;

		if (_1 != null ? !_1.equals(tuple3._1) : tuple3._1 != null) {
			return false;
		}
		if (_2 != null ? !_2.equals(tuple3._2) : tuple3._2 != null) {
			return false;
		}
		if (_3 != null ? !_3.equals(tuple3._3) : tuple3._3 != null) {
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		int result = _1 != null ? _1.hashCode() : 0;
		result = 31 * result + (_2 != null ? _2.hashCode() : 0);
		result = 31 * result + (_3 != null ? _3.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "Tuple{" + "_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + '}';
	}
}
